package main

import (
	"context"
	"fmt"

	"google.golang.org/grpc"

	"github.com/code-art/go-micro-mall/proto"
)

func main() {
	conn, err := grpc.Dial("127.0.0.1:8080", grpc.WithInsecure())
	if err != nil {
		fmt.Println("客户端连接失败")
	}
	defer conn.Close()

	client := proto.NewSearchServiceClient(conn)

	req := new(proto.OrderRequest)
	req.ActivityType = 1

	resp, err := client.SearchOrder(context.Background(), req)
	if err != nil {
		fmt.Println("请求响应异常: ", err)
	} else {
		fmt.Println("服务启动成功: ", resp)
	}
}